clear all
clear matrix
version 17
capture log close
set matsize 11000, permanently
set more off, permanently

*-------------------------------------------------------------------------------
* Options	
*-------------------------------------------------------------------------------

global root =    // Define root: where did you save the bad-times folder

global main		= "$root\bad-times\analysis" 

* Create folders & globals
cap mkdir "$main\prog"	    /* for do files */ 	
cap mkdir "$main\graph"	    /* for graphs */ 
cap mkdir "$main\log"	    /* for log files */ 
cap mkdir "$main\temp"	    /* for temporary user generated data files */
cap mkdir "$main\results"	/* for final results */
cap mkdir "$main\data"		/* for additional data */
cap mkdir "$main\miscellaneous" /* for miscellaneous documents */ 
cap mkdir "$main\orig"		/* for original data */

global prog       = "$main\prog"
global graph      = "$main\graph"
global log        = "$main\log"	
global temp       = "$main\temp"	
global results    = "$main\results"
global data       = "$main\data"
global misce      = "$main\miscellaneous"
global orig       = "$main\orig"

global FE = "..\employers\temp"
global BeH = "..\employers\BeH.dta" // created in DP_value	
global BeH_large = "..\employers\BeH_large.dta" // created in DP_value
global BHP19 = "..\employers\data" // in DP_value
global IEB = "$orig\a015244auszug_ieb.dta" // Original data from the IAB	
global value_temp    = "..\employers\temp"
global value_results = "..\employers\results"
global AWFP2       = "$orig\packages-v2"

*-------------------------------------------------------------------------------
cd "$main"
pwd
*-------------------------------------------------------------------------------
		
		ssc install labutil, replace
		ssc install oaxaca, replace
		ssc install a2reg, replace	
		ssc install reghdfe, replace
		ssc install ftools, replace
		ssc install splitit, replace
		ssc install lincomest, replace
		ssc install distinct, replace
		ssc install estout, replace
		ssc install tuples , replace
		ssc install moremata, replace
		ado update, update
	
*-------------------------------------------------------------------------------
dis "$S_DATE" " " "$S_TIME"
*-------------------------------------------------------------------------------

do "$prog\00_BHP"
do "$prog\01_identify_training_end"
do "$prog\02_data_prep"
do "$prog\03_clean_data"
do "$prog\04_find_annual_dominant_job"
do "$prog\05_no_drop.do" // Robustness check (not dropping persons with training < 6 month)
do "$prog\06_01_create_unemployment_rates_SIAB"
do "$prog\06_02_create_unemployment_rates_SIAB_all_workers" 
do "$prog\07_high_skill" // creates dataset need in 10_dom_analysis

do "$prog\08_01_dom_job_analysis_bc.do" // main analysis; Tab. 2-5; Fig. 4-6; Tab. E1, col. 1 and 5; Tab. E2, col. 1
do "$prog\08_02_dom_job_analysis_bc_using_skill-firm.do" // Tab. E1, col. 6
do "$prog\08_03_dom_job_analysis_bc_nl.do" // Tab. E1, col. 2
do "$prog\08_04_dom_job_analysis_bc_add_c.do" // Tab. E1, col. 3
do "$prog\08_05_dom_job_analysis_bc_no_drop.do" // Tab. E1, col. 4
do "$prog\08_06_dom_job_analysis_mediation" // Tab. E4, Tab. E5
do "$prog\08_07_dom_job_analysis_gender_bc.do" // Tab. E2, col. 4-5
do "$prog\08_08_dom_job_analysis_skill_bc.do" // Tab. E2, col. 2-3

do "$prog\09_AWFP" // Tab. 6; Tab. E8
do "$prog\10_ex_margin.do" // Fig. E3; Tab. E7

do "$prog\11_measurement_error_check.do" // Tab. E6

*-------------------------------------------------------------------------------
dis "$S_DATE" " " "$S_TIME"
*-------------------------------------------------------------------------------

clear
cap log close
